package com.person;

import android.content.Context;

import com.person.dao.DBManager;
import com.person.entity.Book;
import com.person.entity.Notes;
import com.person.entity.Person;
import com.person.entity.Student;


/**
 * Created by liyan on 2016/10/30.
 */
public class CommonUtils {
    private DBManager manager;
    public CommonUtils(Context context){
        manager= DBManager.getInstance(context);
    }
    public boolean insertFriend(Book book){
        boolean flag=false;
        flag=manager.getDaoSession().insert(book)!=-1?true:false;
        return  flag;
    }
    public boolean insertNotes(Notes notes){
        boolean flag=false;
        flag=manager.getDaoSession().insert(notes)!=-1?true:false;
        return  flag;
    } public boolean insertPerson(Person person){
        boolean flag=false;
        flag=manager.getDaoSession().insert(person)!=-1?true:false;
        return  flag;
    }public boolean insertStudent(Student student){
        boolean flag=false;
        flag=manager.getDaoSession().insert(student)!=-1?true:false;
        return  flag;
    }
    //    public Cursor queryData(Class<Object> entity,String queryString) {
////        database = SQLiteDatabase.openOrCreateDatabase(query_path, null);
//        Cursor cursor = (Cursor) manager.getDaoSession().queryRaw(entity,queryString,null);
//        manager.getDaoSession().
//        return cursor;// 返回游标
//    }

}